<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>

<fmt:setBundle basename="messages" />
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title><fmt:message key="PAGE_ADMIN" /></title>
<link rel="stylesheet" type="text/css" href="css/mainStyle.css" />
</head>
<body onload="history.pushState(null, null, 'action?command=admin')">
	<jsp:include page="headerAdmin.jsp" />
	
	<div id="adminInfo">
		<strong><fmt:message key="LABEL_ADMIN" /></strong>
		<c:if test="${ empty sessionScope.admissionState}">
			<form action="action" method="post">
				<input type="hidden" name="command" value="complete" /> <input
					type="submit" value="<fmt:message key="BUTTON_COMPLETE"/>"
					id="button">
			</form>
		</c:if>
		<form action="action" method="post">
			<input type="hidden" name="command" value="logout" /> <input
				type="submit" value="<fmt:message key="BUTTON_LOGOUT" />"
				id="button">
		</form>
	</div>
	<c:if test="${requestScope.notApproved==null}">
		<jsp:forward page="/action?command=admin" />
	</c:if>
	<c:if
		test="${(not empty requestScope.notApproved) && (empty sessionScope.admissionState)}">
		<form action="action" method="post">
			<input type="hidden" name="command" value="approve" /> <input
				type="hidden" name="command" value="admin" />
			<table id="approveTable">
				<tr>
					<th id="nameColumn"><fmt:message key="COLUMN_NAME" /></th>
					<th id="scoreColumn"><fmt:message key="COLUMN_SCORE" /></th>
					<th id="facultyColumn"><fmt:message key="COLUMN_FACULTY" /></th>
					<th><fmt:message key="COLUMN_SELECT" /></th>
				</tr>

				<c:forEach var="student" items="${requestScope.notApproved}">
					<tr>
						<td id="nameCell">${student.name}</td>
						<td id="scoreCell">${student.totalScore}</td>
						<td id="facultyCell">${student.faculty.facultyName}</td>
						<td><div>
								<input id="approveCheckbox" type="checkbox" name="approve"
									value="${student.id}"></input>
							</div></td>
					</tr>
				</c:forEach>
				<tr>
					<td><input type="submit"
						value="<fmt:message key="BUTTON_APPROVE" />" id="approveButton" /></td>
				</tr>
			</table>

		</form>
	</c:if>

	<c:if test="${(not empty sessionScope.admissionState)}">
		<h1 id="successListLabel">
			<fmt:message key="LABEL_SUCCESSLIST" />
		</h1>
		<table id="approveTable">

			<tr>
				<th id="nameColumn"><fmt:message key="COLUMN_NAME" /></th>
				<th id="scoreColumn"><fmt:message key="COLUMN_SCORE" /></th>
				<th id="facultyColumn"><fmt:message key="COLUMN_FACULTY" /></th>
			</tr>
			<c:forEach var="student" items="${sessionScope.acceptedStudent}">
				<tr>
					<td id="nameCell">${student.name}</td>
					<td id="scoreCell">${student.totalScore}</td>
					<td id="facultyCell">${student.faculty.facultyName}</td>

				</tr>
			</c:forEach>

		</table>
	</c:if>
	<jsp:include page="footer.jsp" />
</body>
</html>